// 定义语句块
// 定义语句块下面对应的代码块
// 定义块

function MicrobitUnoBlocks(Blockly) {


    var color_basic = '#00979D';
    var color_display = '#00979D';
    var color_music = '#00979D';
    var color_led = '#00979D';
    var color_wifi = '#00979D';
   
    var color_math = '#59C059';
    var color_list = '#E65722';
    var color_text = '#B8860B';
   
    var color_images = '#00979D';
    var color_pin = '#00979D';
    var color_serial = '#00979D';
    var color_control = '#FFAB19';
    var color_events = "#D2691E";


//      当开机时
      Blockly.Blocks.microbitStart = {
//        /**
//         * Block for if-else.
//         * @this Blockly.Block 'micro:bit主程序开始',
//         */
       init: function () {
           this.jsonInit({
               type: 'microbitStart',
               message0: '',
               message1:  Blockly.Msg.MICROBIT_MAINSTART,
               message2: '%1 ',
                args0: [],
                args1: [],
                args2: [
                {
                    type: 'input_statement',
                    name: 'SUBSTACK0'
                }
            ],
               category: Blockly.Categories.event,
               extensions: ['colours_microbit', 'scratch_extension']
           });
       }
   };
   Blockly.ScratchBlocks.VerticalExtensions.MICROBIT = function() {
    this.setColour('#D2691E');
  };
  Blockly.Extensions.register('colours_microbit',Blockly.ScratchBlocks.VerticalExtensions.MICROBIT);

        // 无线循环
    Blockly.Blocks.microbitLoop = {
        init: function (){
            this.setColour(color_events);
            this.appendDummyInput("")
                // .appendField('当开机时');
                .appendField(Blockly.Msg.MICROBIT_LOOP);
            // this.appendValueInput("serialprints1", String);
            this.appendStatementInput('SUBSTACK0')
                .appendField('');
            // this.setPreviousStatement(false);
            this.setNextStatement(false);
            this.setOutputShape(5);
            this.setTooltip('');
        }
    };

    //
    Blockly.Blocks.microbitButton = {
        init: function (){
            this.setColour(color_events);
            this.appendDummyInput("")
                // .appendField('当开机时');
                .appendField(Blockly.Msg.MICROBIT_WHENBUTTON)
                .appendField(new Blockly.FieldDropdown([
                    ['A', "a"],
                    ['B', "b"],
                    ['A+B', "ab"],
                ]), "buttonEvent")
                .appendField(Blockly.Msg.MICROBIT_ISBUTTONEVENT);
            // this.appendValueInput("serialprints1", String);
            this.appendStatementInput('SUBSTACK0')
                .appendField('');
            // this.setPreviousStatement(false);
            this.setNextStatement(false);
            this.setOutputShape(5);
            this.setTooltip('');
        }
    };

    //显示数字  Blockly.Msg.MICROBIT_TRIFFICLIGHTSRED
    Blockly.Blocks.displayShowNumber = {
        init: function () {
            this.setColour(color_images);
            this.appendDummyInput("")
                .appendField(Blockly.Msg.DISPLAYNUMBER)
            this.appendValueInput("displayShowNumber", Number)
            this.setPreviousStatement(true, null);
            this.setNextStatement(true, null);
            this.setTooltip('');
        }
    };

    //显示图像 
    Blockly.Blocks.displayShowImageView = {
        init: function () {
            this.setColour(color_images);
            this.appendDummyInput("")
                .appendField(Blockly.Msg.DISPLAYPICTURE)
                .appendField(new Blockly.FieldDropdown([
                    ['HEART', "Image.HEART"],
                    ['HAPPY', "Image.HAPPY"],
                    ['SMILE', "Image.SMILE"],
                    ['SAD', "Image.SAD"],
                    ['CONFUSED', "Image.CONFUSED"],
                    ['ANGRY', "Image.ANGRY"],
                    ['ASLEEP', "Image.ASLEEP"],
                    ['SURPRISED', "Image.SURPRISED"],
                    ['MEH', "Image.MEH"],
                    ['YES', "Image.YES"],
                    ['NO', "Image.NO"],
                ]), "image")
            this.setPreviousStatement(true, null);
            this.setNextStatement(true, null);
            this.setTooltip('');
        }
    };

    // 显示字符串
    Blockly.Blocks.displayShowString = {
        init: function () {
            this.setColour(color_images);
            this.appendDummyInput("")
                .appendField(Blockly.Msg.DISPLAYSHOW)
            this.appendValueInput("displayShowString", String)
            this.setPreviousStatement(true, null);
            this.setNextStatement(true, null);
            this.setTooltip('');
        }
    };

    // 暂停  millisecond
    Blockly.Blocks.pauseSleep = {
        init: function () {
            this.setColour(color_control);
            this.appendDummyInput("")
                .appendField(Blockly.Msg.SUSPEND)
                this.appendValueInput("sleepTime", Number)
                this.appendDummyInput("")
                .appendField(Blockly.Msg.MILLISECOND)
            this.setPreviousStatement(true, null);
            this.setNextStatement(true, null);
            this.setTooltip('');
        }
    };

    // 显示箭头
    Blockly.Blocks.displayShowArrow = {
        init: function () {
            this.setColour(color_images);
            this.appendDummyInput("")
                .appendField(Blockly.Msg.SHOWARROW)
                .appendField(new Blockly.FieldDropdown([
                    [Blockly.Msg.NORTH, "Image.ARROW_N"],
                    [Blockly.Msg.NORTHEAST, "Image.ARROW_EN"],
                    [Blockly.Msg.EAST, "Image.ARROW_E"],
                    [Blockly.Msg.SOUTHEAST, "Image.ARROW_SE"],
                    [Blockly.Msg.SOUTH, "Image.ARROW_S"],
                    [Blockly.Msg.SOUTHWEST, "Image.ARROW_SW"],
                    [Blockly.Msg.WEST, "Image.ARROW_W"],
                    [Blockly.Msg.NORTHWEST, "Image.ARROW_NW"],
                ]), "displayShowArrow")
            this.appendDummyInput("")
            this.setPreviousStatement(true, null);
            this.setNextStatement(true, null);
            this.setTooltip('');
        }
    };

    //无限循环
    Blockly.Blocks.infiniteCycle = {
        init: function () {
            this.setColour(color_basic);
            this.appendDummyInput("")
                .appendField(Blockly.Msg.LOOP);
            this.appendStatementInput('DO')
                .appendField("");
            this.setPreviousStatement(true);
            this.setNextStatement(true);
            this.setTooltip('');
        }
    };

    //清空屏幕
    Blockly.Blocks.emptyScreen = {
        init: function () {
            this.setColour(color_images);
            this.appendDummyInput("")
                .appendField(Blockly.Msg.CLEAR);
            this.setPreviousStatement(true);
            this.setNextStatement(true);
            this.setTooltip('');
        }
    };


      //当按钮被按下时
      Blockly.Blocks.buttonPressed = {
        init: function () {
            this.setColour(color_display);
            this.appendDummyInput("")
                .appendField(Blockly.Msg.KEY)
                .appendField(new Blockly.FieldDropdown([
                    ['A', "A"],
                    ['B', "B"],
                    ['A+B', "A+B"],
                ]), "Button")
                .appendField(Blockly.Msg.ISPRESSED);
            this.appendStatementInput('DO')
                .appendField("");
            this.setPreviousStatement(true);
            this.setNextStatement(true);
            this.setTooltip('');
        }
    };

    //当改变主板状态
    Blockly.Blocks.stateChange = {
        init: function () {
            this.setColour(color_display);
            this.appendDummyInput("")
                .appendField(Blockly.Msg.CURRENTMOTHERBOARD)
                .appendField(new Blockly.FieldDropdown([
                    [Blockly.Msg.SHOCK, "shock"],
                    [Blockly.Msg.LOGOUP, "up"],
                    [Blockly.Msg.LOGODOWN, "down"],
                    [Blockly.Msg.SCREENUP, "screenup"],
                    [Blockly.Msg.SCREENDOWN, "screendown"],
                    [Blockly.Msg.LEFTTILT, "left"],
                    [Blockly.Msg.RIGHTTILT, "right"],
                    [Blockly.Msg.FREEFALL, "fall"],
                    ['3g', "3g"],
                    ['6g', "6g"],
                    ['8g', "8g"],
                ]), "state");
            this.appendStatementInput('DO')
                .appendField("");
            this.setPreviousStatement(true);
            this.setNextStatement(true);
            this.setTooltip('');
        }
    };

    //当引脚被接通时
    Blockly.Blocks.pinTouched = {
        init: function () {
            this.setColour(color_display);
            this.appendDummyInput("")
                .appendField(Blockly.Msg.WHENPIN)
                .appendField(new Blockly.FieldDropdown([
                    ['p0', "p0"],
                    ['p1', "p1"],
                    ['p2', "p2"],
                ]), "Pin")
                .appendField(Blockly.Msg.ISPRESSED);
            this.appendStatementInput('DO')
                .appendField("");
            this.setPreviousStatement(true);
            this.setNextStatement(true);
            this.setTooltip('');
        }
    };

    //当按钮被按下时
    Blockly.Blocks.buttonPressedTowState = {
        init: function () {
            this.setColour(color_display);
            this.appendDummyInput("")
                .appendField(Blockly.Msg.KEY)
                .appendField(new Blockly.FieldDropdown([
                    ['A', "A"],
                    ['B', "B"],
                    ['A+B', "A+B"],
                ]), "Button")
                .appendField(Blockly.Msg.ISPRESSED);
            this.setOutputShape(Blockly.OUTPUT_SHAPE_HEXAGONAL);
            this.setOutput(true, 'Boolean');
            this.setTooltip('');
        }
    };

    //当引脚被接通
    Blockly.Blocks.pinPressedTowState = {
        init: function () {
            this.setColour(color_display);
            this.appendDummyInput("")
                .appendField(Blockly.Msg.WHENPIN)
                .appendField(new Blockly.FieldDropdown([
                    ['P0', "p0"],
                    ['P1', "p1"],
                    ['P2', "p2"],
                ]), "PinState")
                .appendField(Blockly.Msg.ISPRESSED);
            this.setOutputShape(Blockly.OUTPUT_SHAPE_HEXAGONAL);
            this.setOutput(true, 'Boolean');
            this.setTooltip('');
        }
    };


//加速度
Blockly.Blocks.accelerationValue = {
    init: function () {
        this.setColour(color_display);
        this.appendDummyInput("")
            .appendField(Blockly.Msg.ACCELERATEDSPEED)
            .appendField(new Blockly.FieldDropdown([
                ['x', "x"],
                ['y', "y"],
                ['z', "z"],
            ]), "acceleration")
        this.setOutputShape(Blockly.OUTPUT_SHAPE_ROUND);
        this.setOutput(true, 'String');
        this.setTooltip('');
    }
};

//亮度级别
Blockly.Blocks.brightnessLevel = {
    init: function () {
        this.setColour(color_led);
        this.appendDummyInput("")
            .appendField(Blockly.Msg.BRIGHTNESSLEVEL
                )
        this.setOutputShape(Blockly.OUTPUT_SHAPE_ROUND);
        this.setOutput(true, 'String');
        this.setTooltip('');
    }
};

//指针朝向
Blockly.Blocks.pointerOrientation = {
    init: function () {
        this.setColour(color_display);
        this.appendDummyInput("")
            .appendField(Blockly.Msg.POINTERFACING)
        this.setOutputShape(Blockly.OUTPUT_SHAPE_ROUND);
        this.setOutput(true, 'String');
        this.setTooltip('');
    }
};

//温度
Blockly.Blocks.temperaTure = {
    init: function () {
        this.setColour(color_display);
        this.appendDummyInput("")
            .appendField(Blockly.Msg.TEMPERATURE)
        this.setOutputShape(Blockly.OUTPUT_SHAPE_ROUND);
        this.setOutput(true, 'String');
        this.setTooltip('');
    }
};

    //旋转方式
    Blockly.Blocks.rotationMode = {
        init: function () {
            this.setColour(color_display);
            this.appendDummyInput("")
                .appendField(Blockly.Msg.ROTATE)
                .appendField(new Blockly.FieldDropdown([
                    [Blockly.Msg.ROTATE1, "rotate"],
                    [Blockly.Msg.ROLL, "roll"],
                ]), "rotation")
            this.setOutputShape(Blockly.OUTPUT_SHAPE_ROUND);
            this.setOutput(true, 'String');
            this.setTooltip('');
        }
    };

    //磁力磁力（μT）
    Blockly.Blocks.magneticForce = {
        init: function () {
            this.setColour(color_display);
            this.appendDummyInput("")
                .appendField(Blockly.Msg.MAGNETICFORCE)
                .appendField(new Blockly.FieldDropdown([
                    ['x', "x"],
                    ['y', "y"],
                    ['z', "z"],
                    // [Blockly.Msg.STRENGTH, "strength"],
                ]), "magnetic")
            this.setOutputShape(Blockly.OUTPUT_SHAPE_ROUND);
            this.setOutput(true, 'String');
            this.setTooltip('');
        }
    };

    //运行时间
    Blockly.Blocks.runningTime = {
        init: function () {
            this.setColour(color_display);
            this.appendDummyInput("")
                .appendField(Blockly.Msg.RUNTIME)
            this.setOutputShape(Blockly.OUTPUT_SHAPE_ROUND);
            this.setOutput(true, 'Number');
        }
    };

    //校准指南针
    Blockly.Blocks.calibrateCompass = {
        init: function () {
            this.setColour(color_display);
            this.appendDummyInput("")
                .appendField(Blockly.Msg.CALIBRATECOMPASS)
            this.setPreviousStatement(true, null);
            this.setNextStatement(true, null);
            this.setTooltip('');
        }
    };

    //当引脚被释放时
    Blockly.Blocks.pinPressedThreeState = {
        init: function () {
            this.setColour(color_display);
            this.appendDummyInput("")
                .appendField(Blockly.Msg.WHENPIN)
                .appendField(new Blockly.FieldDropdown([
                    ['p0', "p0"],
                    ['p1', "p1"],
                    ['p2', "p2"],
                ]), "State")
                .appendField(Blockly.Msg.ISRELEASED);
            this.appendStatementInput('DO')
                .appendField("");
            this.setPreviousStatement(true);
            this.setNextStatement(true);
            this.setTooltip('');
        }
    };

    //音乐
    // 播放音调
    Blockly.Blocks.playTone = {
        init: function () {
            this.setColour(color_music);
            this.appendDummyInput("")
                .appendField(Blockly.Msg.PLAYMELODYPIN)
                .appendField(new Blockly.FieldDropdown([
                    ['p0', "pin0"],
                    ['p1', "pin1"],
                    ['p2', "pin2"],
                    ['p3', "pin3"],
                    ['p4', "pin4"],
                    ['p10', "pin10"],
                ]), "playPin") 
            this.appendDummyInput("")
                .appendField(Blockly.Msg.PLAYTONE)
                .appendField(new Blockly.FieldDropdown([
                    [Blockly.Msg.LOWC, "131"],
                    [Blockly.Msg.LOWD, "147"],
                    [Blockly.Msg.LOWE, "165"],
                    [Blockly.Msg.LOWF, "175"],
                    [Blockly.Msg.LOWG, "196"],
                    [Blockly.Msg.LOWA, "220"],
                    [Blockly.Msg.LOWB, "247"],
                    [Blockly.Msg.MIDDLEC, "262"],
                    [Blockly.Msg.MIDDLED, "294"],
                    [Blockly.Msg.MIDDLEE, "330"],
                    [Blockly.Msg.MIDDLEF, "349"],
                    [Blockly.Msg.MIDDLEG, "392"],
                    [Blockly.Msg.MIDDLEA, "440"],
                    [Blockly.Msg.MIDDLEB, "494"],
                    [Blockly.Msg.HIGHC, "523"],
                    [Blockly.Msg.HIGHD, "587"],
                    [Blockly.Msg.HIGHE, "659"],
                    [Blockly.Msg.HIGHF, "698"],
                    [Blockly.Msg.HIGHG, "784"],
                    [Blockly.Msg.HIGHA, "880"],
                    [Blockly.Msg.HIGHB, "988"],
                ]), "tone")
            this.appendDummyInput("")
                .appendField(Blockly.Msg.CONTINUED)
                .appendField(new Blockly.FieldDropdown([
                    ['1', "1"],
                    ['1/2', "0.5"],
                    ['1/4', "0.25"],
                    ['1/8', "0.125"],
                    ['1/16', "0.0625"],
                    ['2', "2"],
                    ['4', "4"],
                ]), "rhythm")
                .appendField(Blockly.Msg.RHYTHM);
            this.setPreviousStatement(true, null);
            this.setNextStatement(true, null);
            this.setTooltip('');
        }
    };

    //播放铃声（Hz）
    Blockly.Blocks.playRingTone = {
        init: function () {
            this.setColour(color_music);
            this.appendDummyInput("")
                .appendField(Blockly.Msg.PLAYMELODYPIN)
                .appendField(new Blockly.FieldDropdown([
                    ['p0', "pin0"],
                    ['p1', "pin1"],
                    ['p2', "pin2"],
                    ['p3', "pin3"],
                    ['p4', "pin4"],
                    ['p10', "pin10"],
                ]), "playPin") 
            this.appendDummyInput("")
                .appendField(Blockly.Msg.PLAYRINGTONE)
                .appendField(new Blockly.FieldDropdown([
                    [Blockly.Msg.LOWC, "131"],
                    [Blockly.Msg.LOWD, "147"],
                    [Blockly.Msg.LOWE, "165"],
                    [Blockly.Msg.LOWF, "175"],
                    [Blockly.Msg.LOWG, "196"],
                    [Blockly.Msg.LOWA, "220"],
                    [Blockly.Msg.LOWB, "247"],
                    [Blockly.Msg.MIDDLEC, "262"],
                    [Blockly.Msg.MIDDLED, "294"],
                    [Blockly.Msg.MIDDLEE, "330"],
                    [Blockly.Msg.MIDDLEF, "349"],
                    [Blockly.Msg.MIDDLEG, "392"],
                    [Blockly.Msg.MIDDLEA, "440"],
                    [Blockly.Msg.MIDDLEB, "494"],
                    [Blockly.Msg.HIGHC, "523"],
                    [Blockly.Msg.HIGHD, "587"],
                    [Blockly.Msg.HIGHE, "659"],
                    [Blockly.Msg.HIGHF, "698"],
                    [Blockly.Msg.HIGHG, "784"],
                    [Blockly.Msg.HIGHA, "880"],
                    [Blockly.Msg.HIGHB, "988"],
                ]), "tone")
            this.setPreviousStatement(true, null);
            this.setNextStatement(true, null);
            this.setTooltip('');
        }
    };

    //暂停播放（ms）
    Blockly.Blocks.pausePlayback = {
        init: function () {
            this.setColour(color_music);
            this.appendDummyInput("")
                .appendField(Blockly.Msg.PAUSEPLAYBACK)
                .appendField(new Blockly.FieldDropdown([
                    ['1', "1"],
                    ['1/2', "0.5"],
                    ['1/4', "0.25"],
                    ['1/8', "0.125"],
                    ['1/16', "0.0625"],
                    ['2', "2"],
                    ['4', "4"],
                ]), "rhythm")
                .appendField(Blockly.Msg.RHYTHM);
            this.setPreviousStatement(true, null);
            this.setNextStatement(true, null);
            this.setTooltip('');
        }
    };

    //播放旋律
    Blockly.Blocks.playMelody = {
        init: function () {
            this.setColour(color_music);
            this.appendDummyInput("")
                .appendField(Blockly.Msg.PLAYMELODYPIN)
                .appendField(new Blockly.FieldDropdown([
                    ['p0', "pin0"],
                    ['p1', "pin1"],
                    ['p2', "pin2"],
                    ['p3', "pin3"],
                    ['p4', "pin4"],
                    ['p10', "pin10"],
                ]), "playPin") 
            this.appendDummyInput("")
                .appendField(Blockly.Msg.PLAYMELODY)
                .appendField(new Blockly.FieldDropdown([
                    ['dadadum', "music.DADADADUM"],
                    ['entertainer', "music.ENTERTAINER"],
                    ['prelude', "music.PRELUDE"],
                    ['ode', "music.ODE"],
                    ['nyan', "music.NYAN"],
                    ['ring tone', "music.RINGTONE"],
                    ['funk', "music.FUNK"],
                    ['blues', "music.BLUES"],
                    ['birthday song', "music.BIRTHDAY"],
                    ['wedding', "music.WEDDING"],
                    ['funereal', "music.FUNERAL"],
                    ['punchline', "music.PUNCHLINE"],
                    ['badd', "music.BADDY"],
                    ['chase', "music.CHASE"],
                    ['bading', "music.BA_DING"],
                    ['jump up', "music.JUMP_UP"],
                    ['jump down', "music.JUMP_DOWN"],
                    ['power up', "music.POWER_UP"],
                    ['power down', "music.POWER_DOWN"],
                ]), "song")
                .appendField(Blockly.Msg.REPEAT)
                .appendField(new Blockly.FieldDropdown([
                    [Blockly.Msg.PLAYONCE, "once"],
                    [Blockly.Msg.INFINITECYCLE, "loop"],
                ]), "frequency");
            this.setPreviousStatement(true, null);
            this.setNextStatement(true, null);
            this.setTooltip('');
        }
    };

    //stopMelody
    
    Blockly.Blocks.stopMelody = {
        init: function () {
            this.setColour(color_music);
            this.appendDummyInput("")
                .appendField(Blockly.Msg.STOPMELODY)
                .appendField(new Blockly.FieldDropdown([
                    ['p0', "pin0"],
                    ['p1', "pin1"],
                    ['p2', "pin2"],
                    ['p3', "pin3"],
                    ['p4', "pin4"],
                    ['p10', "pin10"],
                ]), "stopPin") 
                this.appendDummyInput("")
                .appendField(Blockly.Msg.STOPMUSIC)
            // .appendField(new Blockly.FieldDropdown([
            //     ['全部', "播放一次"],
            //     ['foreground', "foreground"],
            //     ['background', "background"],
            // ]), "rhythm");
            this.setPreviousStatement(true, null);
            this.setNextStatement(true, null);
            this.setTooltip('');
        }
    };

    //将节奏更改为（bpm）  Change rhythm to
    Blockly.Blocks.bpmChange = {
        init: function () {
            this.setColour(color_music);
            this.appendDummyInput("")
                .appendField(Blockly.Msg.CHANGERHYTHM)
            this.appendValueInput("bpm", Number)
            this.setPreviousStatement(true, null);
            this.setNextStatement(true, null);
            this.setTooltip('');
        }
    };

    //将节奏设定为（bpm）
    Blockly.Blocks.bpmSetting = {
        init: function () {
            this.setColour(color_music);
            this.appendDummyInput("")
                .appendField(Blockly.Msg.SETRHYTHM)
            this.appendValueInput("bpm", Number)
            this.setPreviousStatement(true, null);
            this.setNextStatement(true, null);
            this.setTooltip('');
        }
    };

    //Led
    //绘图
    Blockly.Blocks.drawing = {
        init: function () {
            this.setColour(color_images);
            this.appendDummyInput("")
                .appendField(Blockly.Msg.DRAW)
                .appendField(Blockly.Msg.XAXIS)
            this.appendValueInput("x", Number)
            this.appendDummyInput("")
                .appendField(Blockly.Msg.YAXIS)
            this.appendValueInput("y", Number)
            this.setPreviousStatement(true, null);
            this.setNextStatement(true, null);
            this.setTooltip('');
        }
    };

    //取消绘图
    Blockly.Blocks.cancelMapping = {
        init: function () {
            this.setColour(color_images);
            this.appendDummyInput("")
                .appendField(Blockly.Msg.CANCELDRAW)
                .appendField(Blockly.Msg.XAXIS)
            this.appendValueInput("x", Number)
            this.appendDummyInput("")
                .appendField(Blockly.Msg.YAXIS)
            this.appendValueInput("y", Number)
            this.setPreviousStatement(true, null);
            this.setNextStatement(true, null);
            this.setTooltip('');
        }
    };

    //切换绘图
    Blockly.Blocks.switchMapping = {
        init: function () {
            this.setColour(color_images);
            this.appendDummyInput("")
                .appendField(Blockly.Msg.XAXIS)
            this.appendValueInput("x", Number)
            this.appendDummyInput("")
                .appendField(Blockly.Msg.YAXIS)
            this.appendValueInput("y", Number)
            this.appendDummyInput("")
                .appendField(Blockly.Msg.SWITCH)
            this.setPreviousStatement(true, null);
            this.setNextStatement(true, null);
            this.setTooltip('');
        }
    };

    //点图
    Blockly.Blocks.spotMapping = {
        init: function () {
            this.setColour(color_images);
            this.appendDummyInput("")
                .appendField(Blockly.Msg.POINT)
                .appendField(Blockly.Msg.XAXIS)
            this.appendValueInput("x", Number)
            this.appendDummyInput("")
                .appendField(Blockly.Msg.YAXIS)
            this.appendValueInput("y", Number)
            this.appendDummyInput("")
            .appendField(Blockly.Msg.ISLIGHT)
            this.setOutputShape(Blockly.OUTPUT_SHAPE_HEXAGONAL);
            this.setOutput(true, 'Boolean');
            this.setTooltip('');
        }
    };

    //绘制条形图
    Blockly.Blocks.drawBarType = {
        init: function () {
            this.setColour(color_images);
            this.appendDummyInput("")
                .appendField(Blockly.Msg.DRAWBARCHART)
                .appendField(Blockly.Msg.XAXIS)
            this.appendValueInput("x", Number)
            this.appendDummyInput("")
                // .appendField("最高")
                .appendField(Blockly.Msg.MAX)
            this.appendValueInput("y", Number)
            this.setPreviousStatement(true, null);
            this.setNextStatement(true, null);
            this.setTooltip('');
        }
    };

    //绘图 加入亮度条件
    Blockly.Blocks.drawingLight = {
        init: function () {
            this.setColour(color_images);
            this.appendDummyInput("")
            .appendField(Blockly.Msg.DRAW)
            .appendField(Blockly.Msg.XAXIS)
            this.appendValueInput("x", Number)
            this.appendDummyInput("")
                .appendField(Blockly.Msg.YAXIS)
            this.appendValueInput("y", Number);
            this.appendDummyInput("")
                .appendField(Blockly.Msg.BRIGHTNESS)
                this.appendValueInput("brightness", Number);
                // .appendField(new Blockly.FieldDropdown([
                //     ['9', "9"],
                //     ['8', "8"],
                //     ['7', "7"],
                //     ['6', "6"],
                //     ['5', "5"],
                //     ['4', "4"],
                //     ['3', "3"],
                //     ['2', "2"],
                //     ['1', "1"],
                //     ['0', "0"],
                // ]), "brightness")
            // this.appendValueInput("brightness", Number);
            this.setPreviousStatement(true, null);
            this.setNextStatement(true, null);
            this.setTooltip('');
        }
    };

    //亮度
    Blockly.Blocks.brightness = {
        init: function () {
            this.setColour(color_images);
            this.appendDummyInput("")
                .appendField(Blockly.Msg.BRIGHTNESS)
            this.setOutputShape(Blockly.OUTPUT_SHAPE_ROUND);
            this.setOutput(true, 'Number');
            this.setTooltip('');
        }
    };

    //设置亮度
    Blockly.Blocks.setBrightness = {
        init: function () {
            this.setColour(color_images);
            this.appendDummyInput("")
                .appendField(Blockly.Msg.SETBRIGHTNESS)
            this.appendValueInput("brightness", Number);
            this.setPreviousStatement(true, null);
            this.setNextStatement(true, null);
            this.setTooltip('');
        }
    };

    //停止动画
    Blockly.Blocks.stopAnimation = {
        init: function () {
            this.setColour(color_images);
            this.appendDummyInput("")   
                .appendField(Blockly.Msg.STOPANIMATION)
                // .appendField("停止动画")
            this.setPreviousStatement(true, null);
            this.setNextStatement(true, null);
            this.setTooltip('');
        }
    };

    //wifi
    //无线设置组
    Blockly.Blocks.wifiSetting = {
        init: function () {
            this.setColour(color_wifi);
            this.appendDummyInput("")
                .appendField(Blockly.Msg.WIRELESSSETTINGSGROUP)
                // .appendField("无线设置组")
            this.appendValueInput("setWifi", Number)
            this.setPreviousStatement(true, null);
            this.setNextStatement(true, null);
            this.setTooltip('');
        }
    };

     //打开关闭无线
    Blockly.Blocks.openWifi = {
        init: function () {
            this.setColour(color_wifi);
            this.appendDummyInput("")
                
                // .appendField("无线设置组")
                .appendField(new Blockly.FieldDropdown([
                    [Blockly.Msg.OPEN, "on()"],
                    [Blockly.Msg.CLOSE, "off()"],
                ]), "wifiSwitch")
                .appendField(Blockly.Msg.MICROBIT_WIFI)
            this.setPreviousStatement(true, null);
            this.setNextStatement(true, null);
            this.setTooltip('');
        }
    };


    //无线发送数字
    Blockly.Blocks.wifiSendNumber = {
        init: function () {
            this.setColour(color_wifi);
            this.appendDummyInput("")
            .appendField(Blockly.Msg.WIRELESSDIGITAL)
            this.appendValueInput("setWifiNumber", Number)
            this.setPreviousStatement(true, null);
            this.setNextStatement(true, null);
            this.setTooltip('');
        }
    };


    //无线发送值
    Blockly.Blocks.wifiSettingValue = {
        init: function () {
            this.setColour(color_wifi);
            this.appendDummyInput("")
            .appendField(Blockly.Msg.WIRELESSTRANSMISSIONVALUE)
                // .appendField("无线发送值")
            this.appendValueInput("setWifiName", String)
            this.appendDummyInput("")
                .appendField("=")
            this.appendValueInput("setWifiValue", String)
            this.setPreviousStatement(true, null);
            this.setNextStatement(true, null);
            this.setTooltip('');
        }
    };


    //无线发送字符串
    Blockly.Blocks.wifiSettingString = {
        init: function () {
            this.setColour(color_wifi);
            this.appendDummyInput("")
            .appendField(Blockly.Msg.WIRELESSSENDSTRING)
                // .appendField("无线发送字符串")
            this.appendValueInput("setwifiString", String)
            this.setPreviousStatement(true, null);
            this.setNextStatement(true, null);
            this.setTooltip('');
        }
    };

    //无线接收数据
    Blockly.Blocks.receivingData = {
        init: function () {
            this.setColour(color_wifi);
            this.appendDummyInput("")
                .appendField(Blockly.Msg.DATARECEIVEDWIRELESSLY)
                // .appendField("无线接收到的数据")
            this.setOutputShape(Blockly.OUTPUT_SHAPE_ROUND);
            this.setOutput(true, 'String');
            this.setTooltip('');
        }
    };

    //在无线接收到数据时运行    
    Blockly.Blocks.receivingDataStatusOne = {
        init: function () {
            this.setColour(color_wifi);
            this.appendDummyInput("")
            .appendField(Blockly.Msg.RECEIVEDWIRELESSLY)
                // .appendField("在无线接收到数据时运行")
            this.appendStatementInput('DO')
                .appendField("");
            this.setPreviousStatement(false);
            this.setNextStatement(false);
            this.setTooltip('');
        }
    };

    //在无线接收到数据时运行
    Blockly.Blocks.receivingDataStatusTwo = {
        init: function () {
            this.setColour(color_wifi);
            this.appendDummyInput("")
            .appendField(Blockly.Msg.RECEIVEDSTRINGWIRELESSLY)
                // .appendField("在无线接收到字符串数据时运行")
            this.appendStatementInput('DO')
                .appendField("");
            this.setPreviousStatement(false);
            this.setNextStatement(false);
            this.setTooltip('');
        }
    };


    Blockly.Blocks.receivingDataStatusThree = {
        init: function () {
            this.setColour(color_wifi);
            this.appendDummyInput("")
            .appendField(Blockly.Msg.RECEIVEDKEYVALUEWIRELESSLY)
                // .appendField("在无线接收到key-value数据时运行")
            this.appendStatementInput('DO')
                .appendField("");
            this.setPreviousStatement(false);
            this.setNextStatement(false);
            this.setTooltip('');
        }
    };

    //接收到的数据包
    Blockly.Blocks.packetsReceived = {
        init: function () {
            this.setColour(color_wifi);
            this.appendDummyInput("")
                // .appendField("接收到的数据包")
                .appendField(Blockly.Msg.PACKETSRECEIVED)
                .appendField(new Blockly.FieldDropdown([
                    [Blockly.Msg.TIME, "time"]
                ]), "weightgetas")
            this.setOutputShape(Blockly.OUTPUT_SHAPE_ROUND);
            this.setOutput(true, 'Number');
            this.setTooltip('');
        }
    };

    //无线设置发射功率
    Blockly.Blocks.wifiTansmitPower = {
        init: function () {
            this.setColour(color_wifi);
            this.appendDummyInput("")
                .appendField(Blockly.Msg.WIRELESSSETTRANSMITPOWER)
                // .appendField("无线设置发射功率")
                .appendField(new Blockly.FieldDropdown([
                    ['6', "6"],
                    ['0', "0"],
                    ['1', "1"],
                    ['2', "2"],
                    ['3', "3"],
                    ['4', "4"],
                    ['5', "5"],
                    ['7', "7"]
                ]), "power")
            this.setPreviousStatement(true, null);
            this.setNextStatement(true, null);
            this.setTooltip('');
        }
    };

    //数学
    Blockly.Blocks.initData = {
        init: function () {
            this.setColour(color_math);
            this.appendValueInput("data", Number);
            this.setOutputShape(Blockly.OUTPUT_SHAPE_ROUND);
            this.setOutput(true, 'Number');
            this.setTooltip('');
        }
    };

    //余数
    Blockly.Blocks.remainder = {
        init: function () {
            this.setColour(color_math);
            this.appendValueInput("data1", Number);
            this.appendDummyInput("")
                .appendField(Blockly.Msg.AND)
            this.appendValueInput("data2", Number);
            this.appendDummyInput("")
                .appendField(Blockly.Msg.REMAINDER)
                // .appendField("的余数");
            this.setOutputShape(Blockly.OUTPUT_SHAPE_ROUND);
            this.setOutput(true, 'Number');
            this.setTooltip('');
        }
    };

    //两个数间的最大值于最小值
    Blockly.Blocks.betweenNumbers = {
        init: function () {
            this.setColour(color_math);
            this.appendValueInput("data1", Number);
            this.appendDummyInput("")
                .appendField(Blockly.Msg.AND)
                // .appendField("与");
            this.appendValueInput("data2", Number);
            this.appendDummyInput("")
                .appendField(Blockly.Msg.IN)
                // .appendField("中的")
                .appendField(new Blockly.FieldDropdown([
                    [Blockly.Msg.MIN, "min"],
                    [Blockly.Msg.MAX1, "max"],
                ]), "most")
                this.appendDummyInput("")
                .appendField(Blockly.Msg.VALUE)
            this.setOutputShape(Blockly.OUTPUT_SHAPE_ROUND);
            this.setOutput(true, 'Number');
            this.setTooltip('');
        }
    };

    //绝对值
    Blockly.Blocks.absoluteValue = {
        init: function () {
            this.setColour(color_math);
            this.appendValueInput("absolute", String);
            this.appendDummyInput("")
                .appendField(Blockly.Msg.ABS)
                // .appendField("的绝对值");
            this.setOutputShape(Blockly.OUTPUT_SHAPE_ROUND);
            this.setOutput(true, 'Number');
            this.setTooltip('');
        }
    };

    //平方根
    Blockly.Blocks.squareRoot = {
        init: function () {
            this.setColour(color_math);
            this.appendDummyInput("")
                .appendField(new Blockly.FieldDropdown([
                    ['sqrt', "sqrt"],
                    ['sin', "sin"],
                    ['cos', "cos"],
                    ['tan', "tan"],
                    ['atan2', "atan2"],
                ]), "type");
            this.appendValueInput("data", Number);
            this.setOutputShape(Blockly.OUTPUT_SHAPE_ROUND);
            this.setOutput(true, 'Number');
            this.setTooltip('');
        }
    };

    //选取随机数
    Blockly.Blocks.selectRandomNumber = {
        init: function () {
            this.setColour(color_math);
            this.appendDummyInput("")
                .appendField(Blockly.Msg.RANDOM)
                .appendField(Blockly.Msg.RANGE)
                // .appendField("选取随机数。范围为");
            this.appendValueInput("data1", Number);
            this.appendDummyInput("")
                .appendField("~");
            this.appendValueInput("data2", Number);
            this.setOutputShape(Blockly.OUTPUT_SHAPE_ROUND);
            this.setOutput(true, 'Number');
            this.setTooltip('');
        }
    };

    //随机选取true或者false
    Blockly.Blocks.randomBoolean = {
        init: function () {
            this.setColour(color_math);
            this.appendDummyInput("")
            .appendField(Blockly.Msg.RANDOMBOOLEAN)
                // .appendField("随机选取true 或 false");
            this.setOutputShape(Blockly.OUTPUT_SHAPE_HEXAGONAL);
            this.setOutput(true, 'Boolean');
            this.setTooltip('');
        }
    };

    //transferInt
    Blockly.Blocks.transferInt = {
        init: function () {
            this.setColour(color_math);
            // .appendField("长度");
            this.appendValueInput("data", Number)
            this.appendDummyInput("")
            .appendField(Blockly.Msg.TRANSFERINT)
                // .appendField("随机选取true 或 false");
            this.setOutputShape(Blockly.OUTPUT_SHAPE_ROUND);
            this.setOutput(true, 'Number');
            this.setTooltip('');
        }
    };

    Blockly.Blocks.listLength = {
        init: function () {
            this.setColour(color_list);
            this.appendDummyInput("")
            .appendField(Blockly.Msg.ARRAY)
                // .appendField("数组")
                .appendField(new Blockly.FieldDropdown([
                    ['list', "list"],
                    ['Test List', "Test List"],
                ]), "weightgetas")
                .appendField(Blockly.Msg.LENGTH)
                // .appendField("长度");
            this.appendValueInput("index", Number)
            this.setOutputShape(Blockly.OUTPUT_SHAPE_ROUND);
            this.setOutput(true, 'Number');
            this.setTooltip('');
        }
    };

    //获取数组索引得值
    Blockly.Blocks.getListIndexValue = {
        init: function () {
            this.setColour(color_list);
            this.appendDummyInput("")
            .appendField(Blockly.Msg.ARRAY)
                .appendField(new Blockly.FieldDropdown([
                    ['list', "list"],
                    ['Test List', "文本列表"],
                ]), "weightgetas")
                .appendField(Blockly.Msg.GETINDEX);
            this.appendValueInput("index", Number)
            this.appendDummyInput("")
            .appendField(Blockly.Msg.VALUE);
            this.setOutputShape(Blockly.OUTPUT_SHAPE_ROUND);
            this.setOutput(true, 'Number');
            this.setTooltip('');
        }
    };

    //设置数组索引得值
    Blockly.Blocks.setListIndexValue = {
        init: function () {
            this.setColour(color_list);
            this.appendDummyInput("")
                .appendField(Blockly.Msg.ARRAY)
                .appendField(new Blockly.FieldDropdown([
                    ['list', "list"],
                    ['文本列表', "文本列表"],
                ]), "weightgetas")
                .appendField(Blockly.Msg.INDEX);
                // .appendField("中索引");
            this.appendValueInput("index", Number);
            this.appendDummyInput("")
            .appendField(Blockly.Msg.VALUESET);
                // .appendField("的值设置为");
            this.appendValueInput("value", String);
            this.setPreviousStatement(true, null);
            this.setNextStatement(true, null);
            this.setTooltip('');
        }
    };

    //添加值到list中
    Blockly.Blocks.addValueToList = {
        init: function () {
            this.setColour(color_list);
            this.appendDummyInput("")
                .appendField("   ")
                .appendField(new Blockly.FieldDropdown([
                    ['list', "list"],
                    ['文本列表', "文本列表"],
                ]), "weightgetas")
                .appendField(Blockly.Msg.VALUE);
                // .appendField("将值");
            this.appendValueInput("value", String);
            this.appendDummyInput("")
            .appendField(Blockly.Msg.ADDTOEND);
                // .appendField("添加到结尾");
            this.setPreviousStatement(true, null);
            this.setNextStatement(true, null);
            this.setTooltip('');
        }
    };

    //获取并移除数组中最后一个值
    Blockly.Blocks.removeEndValue = {
        init: function () {
            this.setColour(color_list);
            this.appendDummyInput("")
                .appendField(Blockly.Msg.GETANDREMOVE)
                // .appendField("获取并移除")
                .appendField(new Blockly.FieldDropdown([
                    ['list', "list"],
                    // ['列表', "列表"],
                    ['文本列表', "文本列表"],
                ]), "weightgetas")
                .appendField(Blockly.Msg.LASTVALUE);
                // .appendField("中的最后一个值");
            this.setOutputShape(Blockly.OUTPUT_SHAPE_ROUND);
            this.setOutput(true, 'Number');
            this.setTooltip('');
        }
    };

    //查找某个值在数组中的下标
    Blockly.Blocks.getValuePosition = {
        init: function () {
            this.setColour(color_list);
            this.appendDummyInput("")
                .appendField(new Blockly.FieldDropdown([
                    ['list', "list"],
                    ['文本列表', "文本列表"],
                ]), "weightgetas")
                .appendField(Blockly.Msg.FIND);
                // .appendField("查找");
            this.appendValueInput("value", String);
            this.appendDummyInput("")
            .appendField(Blockly.Msg.INDEX);
            this.setOutputShape(Blockly.OUTPUT_SHAPE_ROUND);
            this.setOutput(true, 'Number');
            this.setTooltip('');
        }
    };

    //获取并移除数组中第一个值
    Blockly.Blocks.removeStartValue = {
        init: function () {
            this.setColour(color_list);
            this.appendDummyInput("")
                // .appendField("获取并移除")
                .appendField(Blockly.Msg.GETANDREMOVE)
                .appendField(new Blockly.FieldDropdown([
                    ['list', "list"],
                    ['文本列表', "文本列表"],
                ]), "weightgetas")
                .appendField(Blockly.Msg.STARTVALUE);
                // .appendField("中的第一个值");
            this.setOutputShape(Blockly.OUTPUT_SHAPE_ROUND);
            this.setOutput(true, 'Number');
            this.setTooltip('');
        }
    };

    //添加值到数组起始位置中
    Blockly.Blocks.addValueToListHead = {
        init: function () {
            this.setColour(color_list);
            this.appendDummyInput("")
                .appendField("   ")
                .appendField(new Blockly.FieldDropdown([
                    ['list', "list"],
                    ['文本列表', "文本列表"],
                ]), "weightgetas")
                .appendField(Blockly.Msg.INSERTATBEGIN);
                // .appendField("在开头插入");
            this.appendValueInput("value", String);
            this.setPreviousStatement(true, null);
            this.setNextStatement(true, null);
            this.setTooltip('');
        }
    };

    //添加值到列表中某个位置
    Blockly.Blocks.addValueToListPosition = {
        init: function () {
            this.setColour(color_list);
            this.appendDummyInput("")
                .appendField("   ")
                .appendField(new Blockly.FieldDropdown([
                    ['list', "list"],
                    ['文本列表', "文本列表"],
                ]), "weightgetas")
                // .appendField("在");
                .appendField(Blockly.Msg.STAY);
            this.appendValueInput("index", Number);
            this.appendDummyInput("")
            .appendField(Blockly.Msg.INSERTVALUE);
                // .appendField("处插入值");
            this.appendValueInput("value", String);
            this.setPreviousStatement(true, null);
            this.setNextStatement(true, null);
            this.setTooltip('');
        }
    };

    //移除列表某处的值
    Blockly.Blocks.removePositionValue = {
        init: function () {
            this.setColour(color_list);
            this.appendDummyInput("")
                .appendField(new Blockly.FieldDropdown([
                    ['list', "list"],
                    ['文本列表', "文本列表"],
                ]), "weightgetas")
                .appendField(Blockly.Msg.REMOVE)
                .appendField(Blockly.Msg.INDEX);
                // .appendField("移除");
            this.appendValueInput("index", Number);
            this.appendDummyInput("")
                .appendField(Blockly.Msg.VALUE);
            this.setOutputShape(Blockly.OUTPUT_SHAPE_ROUND);
            this.setOutput(true, 'Number');
            this.setTooltip('');
        }
    };

    //文本
    //空值
    Blockly.Blocks.nullValue = {
        init: function () {
            this.setColour(color_text);
            this.appendDummyInput("")
            .appendField(Blockly.Msg.ENTERVALUE);
            this.appendValueInput("inputText", String);
            this.setOutputShape(Blockly.OUTPUT_SHAPE_ROUND);
            this.setOutput(true, 'String');
            this.setTooltip('');
        }
    };

    //返回字符的长度
    Blockly.Blocks.returnStringLength = {
        init: function () {
            this.setColour(color_text);
            this.appendValueInput("inputText", String);
            this.appendDummyInput("")
            .appendField(Blockly.Msg.LENGTH);
                // .appendField("的长度");
            this.setOutputShape(Blockly.OUTPUT_SHAPE_ROUND);
            this.setOutput(true, 'Number');
            this.setTooltip('');
        }
    };

    //比较两个字符串
    Blockly.Blocks.comparativeText = {
        init: function () {
            this.setColour(color_text);
            this.appendDummyInput("")
            .appendField(Blockly.Msg.COMPARE);
                // .appendField("比较");
            this.appendValueInput("inputText1", String);
            this.appendDummyInput("")
            .appendField(Blockly.Msg.AND);
                // .appendField("与");
            this.appendValueInput("inputText2", String);
            this.setOutputShape(Blockly.OUTPUT_SHAPE_ROUND);
            this.setOutput(true, 'Number');
            this.setTooltip('');
        }
    };

    //获取字符串中的一部分 Starting position
    Blockly.Blocks.getSubString = {
        init: function () {
            this.setColour(color_text);
            this.appendDummyInput("")
            .appendField(Blockly.Msg.GET);
            this.appendValueInput("inputText", String);
            this.appendDummyInput("")
                .appendField(Blockly.Msg.STRING)
                .appendField(Blockly.Msg.STARTPOSITION);
            this.appendValueInput("startPosition", Number);
            this.appendDummyInput("")
            .appendField(Blockly.Msg.STRLENGTH);
                // .appendField(",长度");
            this.appendValueInput("length", Number);
            this.setOutputShape(Blockly.OUTPUT_SHAPE_ROUND);
            this.setOutput(true, 'String');
            this.setTooltip('');
        }
    };

    //判断字符串是否为空
    Blockly.Blocks.isEmptyText = {
        init: function () {
            this.setColour(color_text);
            this.appendValueInput("inputText", String)
            this.appendDummyInput("")
            .appendField(Blockly.Msg.ISEMPTY)
                // .appendField("为空")
            this.setOutputShape(Blockly.OUTPUT_SHAPE_HEXAGONAL);
            this.setOutput(true, 'Boolean');
            this.setTooltip('');
        }
    };

    //将字符串转化为number类型
    Blockly.Blocks.parseToNumber = {
        init: function () {
            this.setColour(color_text);
            this.appendDummyInput("")
                .appendField(Blockly.Msg.PARSETONUMBER)
            this.appendValueInput("inputText", String)
            this.setOutputShape(Blockly.OUTPUT_SHAPE_ROUND);
            this.setOutput(true, 'Number');
            this.setTooltip('');
        }
    };

    //获取字符串中的一个字符Extract character position
    Blockly.Blocks.getIndexChar = {
        init: function () {
            this.setColour(color_text);
            this.appendDummyInput("")
                // .appendField("从")
                .appendField(Blockly.Msg.FROM)
            this.appendValueInput("inputText", String)
            this.appendDummyInput("")
            .appendField(Blockly.Msg.EXTRACTCHARACTERPOSITON);
                // .appendField("中提取字符 位置");
            this.appendValueInput("startPosition", Number);
            this.setOutputShape(Blockly.OUTPUT_SHAPE_ROUND);
            this.setOutput(true, 'String');
            this.setTooltip('');
        }
    };

    //提取字符代码中的文本 Extract character code
    Blockly.Blocks.extractText = {
        init: function () {
            this.setColour(color_text);
            this.appendDummyInput("")
                .appendField(Blockly.Msg.EXTRACTCHARACTERCODE)
                // .appendField("提取字符代码")
            this.appendValueInput("inputText", Number)
            this.appendDummyInput("")
            .appendField(Blockly.Msg.TEXT);
                // .appendField("中的文本");
            this.setOutputShape(Blockly.OUTPUT_SHAPE_ROUND);
            this.setOutput(true, 'String');
            this.setTooltip('');
        }
    };

    //convert to text
    Blockly.Blocks.convertToText = {
        init: function () {
            this.setColour(color_text);
            this.appendDummyInput("")
                .appendField(Blockly.Msg.NUMBER)
            this.appendValueInput("integer", Number)
            this.appendDummyInput("")
                .appendField(Blockly.Msg.TOTEXT);
            this.setOutputShape(Blockly.OUTPUT_SHAPE_ROUND);
            this.setOutput(true, 'String');
            this.setTooltip('');
        }
    };

    //图像
    //创建图像
    Blockly.Blocks.createImage = {
        init: function init() {
            this.setColour(color_images);
            this.appendDummyInput("")
            .appendField(Blockly.Msg.CREATEIMAGE);
                // .appendField("创建图像");
            this.appendDummyInput('').appendField(new Blockly.FieldMatrix(), 'CHOICE');
            this.setOutputShape(Blockly.OUTPUT_SHAPE_ROUND);
            this.setOutput(true, 'String');
            this.setTooltip('');
            this.setColour(color_images, Blockly.Colours.motion.secondary, Blockly.Colours.motion.tertiary);
        }
    };

    //显示图像
    Blockly.Blocks.showImage = {
        init: function () {
            this.setColour(color_images);
            this.appendDummyInput("")
            .appendField(Blockly.Msg.CREATEIMAGE);
                // .appendField("显示图像");
            this.appendValueInput("myImage", String);
            this.appendDummyInput("")
                .appendField(new Blockly.FieldDropdown([
                    [Blockly.Msg.UP, "UP"],
                    [Blockly.Msg.DOWN, "DOWN"],
                    [Blockly.Msg.LEFT, "LEFT"],
                    [Blockly.Msg.RIGHT, "RIGHT"],
                ]), "orientation");
            this.appendDummyInput("")
                .appendField(Blockly.Msg.DEVIATION)
                // .appendField("偏移") deviation
            this.appendValueInput("position", Number);
            this.setPreviousStatement(true, null);
            this.setNextStatement(true, null);
            this.setTooltip('');
        }
    };

   //滚动图像 Scroll image
   Blockly.Blocks.rollImage = {
    init: function () {
        this.setColour(color_images);
        this.appendDummyInput("")
        .appendField(Blockly.Msg.SCROLLIMAGE);
            // .appendField("滚动图像");
        this.appendValueInput("myImage", String);
        this.appendDummyInput("")
            .appendField(new Blockly.FieldDropdown([
                [Blockly.Msg.UP, "UP"],
                [Blockly.Msg.DOWN, "DOWN"],
                [Blockly.Msg.LEFT, "LEFT"],
                [Blockly.Msg.RIGHT, "RIGHT"],
            ]), "orientation");
        this.appendDummyInput("")
        .appendField(Blockly.Msg.OFFSETTO) ;
            // .appendField("偏移为")
        this.appendValueInput("position", Number);
        this.appendDummyInput("")
        .appendField(Blockly.Msg.INTERVAL)
            // .appendField("且间隔（ms）为");
        this.appendValueInput("time", Number);
        this.setPreviousStatement(true, null);
        this.setNextStatement(true, null);
        this.setTooltip('');
    }
};

    //箭头图像 Arrow image
    Blockly.Blocks.arrowImage = {
        init: function () {
            this.setColour(color_images);
            this.appendDummyInput("")
            .appendField(Blockly.Msg.ARROWIMAGE)
                // .appendField("箭头图像")
                .appendField(new Blockly.FieldDropdown([
                    [Blockly.Msg.NORTH, "north"],
                    [Blockly.Msg.NORTHEAST, "northeast"],
                    [Blockly.Msg.EAST, "east"],
                    [Blockly.Msg.SOUTHEAST, "southeast"],
                    [Blockly.Msg.SOUTH, "south"],
                    [Blockly.Msg.SOUTHWEST, "southwest"],
                    [Blockly.Msg.WEST, "west"],
                    [Blockly.Msg.NORTHWEST, "northwest"],
                ]), "arrow")
            this.setOutputShape(Blockly.OUTPUT_SHAPE_ROUND);
            this.setOutput(true, 'String');
            this.setTooltip('');
        }
    };

    //引脚  Digital read pin
    //数字读取引脚
    Blockly.Blocks.digitalReadPin = {
        init: function () {
            this.setColour(color_pin);
            this.appendDummyInput("")
                .appendField(Blockly.Msg.DIGITALREADPIN)
                // .appendField("数字读取引脚")
                .appendField(new Blockly.FieldDropdown([
                    ['p0', "pin0"],
                    ['p1', "pin1"],
                    ['p2', "pin2"],
                    ['p3', "pin3"],
                    ['p4', "pin4"],
                    ['p5', "pin5"],
                    ['p6', "pin6"],
                    ['p7', "pin7"],
                    ['p8', "pin8"],
                    ['p9', "pin9"],
                    ['p10', "pin10"],
                    ['p11', "pin11"],
                    ['p12', "pin12"],
                    ['p13', "pin13"],
                    ['p14', "pin14"],
                    ['p15', "pin15"],
                    ['p16', "pin16"],
                    ['p17', "pin17"],
                    ['p18', "pin18"],
                    ['p19', "pin19"],
                    ['p20', "pin20"],
                ]), "pin")
            this.setOutputShape(Blockly.OUTPUT_SHAPE_ROUND);
            this.setOutput(true, 'String');
            this.setTooltip('');
        }
    };


    //向引脚数字写入值  Direction pin
    Blockly.Blocks.writeDigitalValue = {
        init: function () {
            this.setColour(color_pin);
            this.appendDummyInput("")
            .appendField(Blockly.Msg.DIRECTIONPIN)
                // .appendField("向 引脚")
                .appendField(new Blockly.FieldDropdown([
                    ['p0', "pin0"],
                    ['p1', "pin1"],
                    ['p2', "pin2"],
                    ['p3', "pin3"],
                    ['p4', "pin4"],
                    ['p5', "pin5"],
                    ['p6', "pin6"],
                    ['p7', "pin7"],
                    ['p8', "pin8"],
                    ['p9', "pin9"],
                    ['p10', "pin10"],
                    ['p11', "pin11"],
                    ['p12', "pin12"],
                    ['p13', "pin13"],
                    ['p14', "pin14"],
                    ['p15', "pin15"],
                    ['p16', "pin16"],
                    ['p17', "pin17"],
                    ['p18', "pin18"],
                    ['p19', "pin19"],
                    ['p20', "pin20"],
                ]), "pin")
                .appendField(Blockly.Msg.DIGITALWRITEPIN);
                // .appendField("数字写入值");
            this.appendValueInput("value", Number);
            this.setPreviousStatement(true, null);
            this.setNextStatement(true, null);
            this.setTooltip('');
        }
    };

    //模拟读取引脚
    Blockly.Blocks.analogReadPin = {
        init: function () {
            this.setColour(color_pin);
            this.appendDummyInput("")
            .appendField(Blockly.Msg.ANALOGREADPIN)
                // .appendField("模拟读取 引脚")
                .appendField(new Blockly.FieldDropdown([
                    ['p0', "pin0"],
                    ['p1', "pin1"],
                    ['p2', "pin2"],
                    ['p3', "pin3"],
                    ['p4', "pin4"],
                    ['p10', "pin10"],
                ]), "pin")
            this.setOutputShape(Blockly.OUTPUT_SHAPE_ROUND);
            this.setOutput(true, 'String');
            this.setTooltip('');
        }
    };

    //向引脚数字写入模拟值
    Blockly.Blocks.writeAnalogValue = {
        init: function () {
            this.setColour(color_pin);
            this.appendDummyInput("")
            .appendField(Blockly.Msg.DIRECTIONPIN)
                // .appendField("向 引脚")
                .appendField(new Blockly.FieldDropdown([
                    ['p0', "pin0"],
                    ['p1', "pin1"],
                    ['p2', "pin2"],
                    ['p3', "pin3"],
                    ['p4', "pin4"],
                    ['p5', "pin5"],
                    ['p6', "pin6"],
                    ['p7', "pin7"],
                    ['p8', "pin8"],
                    ['p9', "pin9"],
                    ['p10', "pin10"],
                    ['p11', "pin11"],
                    ['p12', "pin12"],
                    ['p13', "pin13"],
                    ['p14', "pin14"],
                    ['p15', "pin15"],
                    ['p16', "pin16"],
                    ['p17', "pin17"],
                    ['p18', "pin18"],
                    ['p19', "pin19"],
                    ['p20', "pin20"],
                ]), "pin")
                .appendField(Blockly.Msg.ANALOGWRITEPIN);
                // .appendField("模拟写入");
            this.appendValueInput("value", Number);
            this.setPreviousStatement(true, null);
            this.setNextStatement(true, null);
            this.setTooltip('');
        }
    };

   //映射
   Blockly.Blocks.mapping = {
    init: function () {
        this.setColour(color_pin);
        this.appendDummyInput("")
        .appendField(Blockly.Msg.MAPPING);
            // .appendField("映射");
        this.appendValueInput("mapping", Number);
        this.appendDummyInput("")
        .appendField(Blockly.Msg.FROMLOW);
            // .appendField("从低");
        this.appendValueInput("low", Number);
        this.appendDummyInput("")
        .appendField(Blockly.Msg.FROMHIGH);
            // .appendField("从高");
        this.appendValueInput("high", Number);
        this.appendDummyInput("")
        .appendField(Blockly.Msg.TOLOW);
            // .appendField("至低");
        this.appendValueInput("tolow", Number);
        this.appendDummyInput("")
        .appendField(Blockly.Msg.TOHIGH);
            // .appendField("至高");
        this.appendValueInput("tohigh", Number);
        this.setOutputShape(Blockly.OUTPUT_SHAPE_ROUND);
        this.setOutput(true, 'String');
        this.setTooltip('');
    }
};

//向伺服机构写值
Blockly.Blocks.writeServoValue = {
    init: function () {
        this.setColour(color_pin);
        this.appendDummyInput("")
        .appendField(Blockly.Msg.TOSERVOPIN)
            // .appendField("向伺服机构 引脚")
            .appendField(new Blockly.FieldDropdown([
                ['p0', "pin0"],
                ['p1', "pin1"],
                ['p2', "pin2"],
                ['p3', "pin3"],
                ['p4', "pin4"],
                ['p10', "pin10"],
            ]), "pin")
            .appendField(Blockly.Msg.WRITE);
            // .appendField("写入");
        this.appendValueInput("value", Number);
        this.setPreviousStatement(true, null);
        this.setNextStatement(true, null);
        this.setTooltip('');
    }
};

    //设置伺服机构脉冲
    Blockly.Blocks.setServoPulse = {
        init: function () {
            this.setColour(color_pin);
            this.appendDummyInput("")
            .appendField(Blockly.Msg.TOSERVOPIN)
                // .appendField("向伺服机构 引脚")
                .appendField(new Blockly.FieldDropdown([
                    ['p0', "pin0"],
                    ['p1', "pin1"],
                    ['p2', "pin2"],
                    ['p3', "pin3"],
                    ['p4', "pin4"],
                    ['p10', "pin10"],
                ]), "pin")
                .appendField(Blockly.Msg.PULSESET);
                // .appendField("脉冲设置为（ms）"); Pulse set to
            this.appendValueInput("pulse", Number);
            this.setPreviousStatement(true, null);
            this.setNextStatement(true, null);
            this.setTooltip('');
        }
    };

    //当引脚状态改变时
    Blockly.Blocks.statusChangesEvent = {
        init: function () {
            this.setColour(color_pin);
            this.appendDummyInput("")
            .appendField(Blockly.Msg.WHENPIN)
                // .appendField("当引脚")
                .appendField(new Blockly.FieldDropdown([
                    ['p0', "pin0"],
                    ['p1', "pin1"],
                    ['p2', "pin2"],
                    ['p3', "pin3"],
                    ['p4', "pin4"],
                    ['p5', "pin5"],
                    ['p6', "pin6"],
                    ['p7', "pin7"],
                    ['p8', "pin8"],
                    ['p9', "pin9"],
                    ['p10', "pin10"],
                    ['p11', "pin11"],
                    ['p12', "pin12"],
                    ['p13', "pin13"],
                    ['p14', "pin14"],
                    ['p15', "pin15"],
                    ['p16', "pin16"],
                    ['p17', "pin17"],
                    ['p18', "pin18"],
                    ['p19', "pin19"],
                    ['p20', "pin20"],
                ]), "pin")
                .appendField(Blockly.Msg.PULSE)
                // .appendField("脉冲为")
                .appendField(new Blockly.FieldDropdown([
                    [Blockly.Msg.HIGH, "high"],
                    [Blockly.Msg.LOW, "low"],
                ]), "status")
            this.appendStatementInput('DO')
                .appendField("");
            this.setPreviousStatement(true);
            this.setNextStatement(true);
            this.setTooltip('');
        }
    };

    //脉冲持续时间（μs） Pulse duration
    Blockly.Blocks.pulseDuration = {
        init: function () {
            this.setColour(color_pin);
            this.appendDummyInput("")
            .appendField(Blockly.Msg.PULSEDURATION);
                // .appendField("脉冲持续时间（μs）");
            this.setOutputShape(Blockly.OUTPUT_SHAPE_ROUND);
            this.setOutput(true, 'String');
            this.setTooltip('');
        }
    };

    //脉冲引脚持续时间（μs）——
    Blockly.Blocks.pulseDurationPin = {
        init: function () {
            this.setColour(color_pin);
            this.appendDummyInput("")
            .appendField(Blockly.Msg.PULSEDURATIONPIN)
                // .appendField("脉冲持续时间（μs）引脚")
                .appendField(new Blockly.FieldDropdown([
                    ['p0', "pin0"],
                    ['p1', "pin1"],
                    ['p2', "pin2"],
                    ['p3', "pin3"],
                    ['p4', "pin4"],
                    ['p5', "pin5"],
                    ['p6', "pin6"],
                    ['p7', "pin7"],
                    ['p8', "pin8"],
                    ['p9', "pin9"],
                    ['p10', "pin10"],
                    ['p11', "pin11"],
                    ['p12', "pin12"],
                    ['p13', "pin13"],
                    ['p14', "pin14"],
                    ['p15', "pin15"],
                    ['p16', "pin16"],
                    ['p17', "pin17"],
                    ['p18', "pin18"],
                    ['p19', "pin19"],
                    ['p20', "pin20"],
                ]), "pin")
                .appendField(Blockly.Msg.PULSE)
                // .appendField("脉冲为")
                .appendField(new Blockly.FieldDropdown([
                    [Blockly.Msg.HIGH, "high"],
                    [Blockly.Msg.LOW, "low"],
                    // ['高', "高"],
                    // ['低', "低"],
                ]), "status");
            this.setOutputShape(Blockly.OUTPUT_SHAPE_ROUND);
            this.setOutput(true, 'String');
            this.setTooltip('');
        }
    };

    //spi 写入
    Blockly.Blocks.spiWrite = {
        init: function () {
            this.setColour(color_pin);
            this.appendDummyInput("")
            .appendField(Blockly.Msg.SPIWRITE);
                // .appendField("spi 写入");
            this.appendValueInput("value", Number);
            this.setOutputShape(Blockly.OUTPUT_SHAPE_ROUND);
            this.setOutput(true, 'String');
            this.setTooltip('');
        }
    };

    //spi 频率
    Blockly.Blocks.spiFrequency = {
        init: function () {
            this.setColour(color_pin);
            this.appendDummyInput("")
            .appendField(Blockly.Msg.SPIFREQUENCY);
                // .appendField("spi 频率");
            this.appendValueInput("value", Number);
            this.appendDummyInput("")
            .appendField("(HZ)");
            this.setPreviousStatement(true);
            this.setNextStatement(true);
            this.setTooltip('');
        }
    };

    //模拟设置音阶引脚
    Blockly.Blocks.setAnalogScalePin = {
        init: function () {
            this.setColour(color_pin);
            this.appendDummyInput("")
            .appendField(Blockly.Msg.SETANALOGSCALEPIN)
            .appendField(new Blockly.FieldDropdown([
                ['p0', "pin0"],
                ['p1', "pin1"],
                ['p2', "pin2"],
                ['p3', "pin3"],
                ['p4', "pin4"],
                ['p10', "pin10"],
            ]), "pin")
            this.appendDummyInput("")
            .appendField(Blockly.Msg.FREQUENCY)
                // .appendField("模拟设置音阶引脚")
            this.appendValueInput("frequency", Number);
            this.appendDummyInput("")
            .appendField("(HZ)");
            this.appendDummyInput("")
            .appendField(Blockly.Msg.DURATION)
            this.appendValueInput("time", Number);
            this.appendDummyInput("")
            .appendField("(ms)");
            this.setPreviousStatement(true);
            this.setNextStatement(true);
            this.setTooltip('');
        }
    };

    //spi 格式 位数
    Blockly.Blocks.spiFormatDigits = {
        init: function () {
            this.setColour(color_pin);
            this.appendDummyInput("")
            .appendField(Blockly.Msg.SPIFORMATDIGITS);
            this.appendDummyInput("")
            .appendField(new Blockly.FieldDropdown([
                ['8 bit', "8"],
            ]), "value");
                // .appendField("spi 格式 位数");
            // this.appendValueInput("value", Number);
            this.appendDummyInput("")
            .appendField(Blockly.Msg.MODEL);
            this.appendDummyInput("")
            .appendField(new Blockly.FieldDropdown([
                ['Mode1', "0"],
                ['Mode2', "1"],
                ['Mode3', "2"],
                ['Mode4', "3"],
            ]), "mode");
                // .appendField("模式");
            // this.appendValueInput("mode", Number);
            this.setPreviousStatement(true);
            this.setNextStatement(true);
            this.setTooltip('');
        }
    };

    //spi 设置引脚  SPI set pin MoSi
    Blockly.Blocks.spiSetPin = {
        init: function () {
            this.setColour(color_pin);
            this.appendDummyInput("")
            .appendField(Blockly.Msg.SPISETPINMOSI)
                // .appendField("spi 设置引脚 MOSI")
                .appendField(new Blockly.FieldDropdown([
                    ['p15', "pin15"],
                ]), "mosi")
                .appendField("MISO")
                .appendField(new Blockly.FieldDropdown([
                    ['p14', "pin14"],
                ]), "miso")
                .appendField("SCLK")
                .appendField(new Blockly.FieldDropdown([
                    ['p13', "pin13"],
                ]), "sdk")
            this.setPreviousStatement(true);
            this.setNextStatement(true);
            this.setTooltip('');
        }
    };

    //串口
    // 串口打印字符串
    Blockly.Blocks.serialPrintingString = {
        init: function () {
            this.setColour(color_serial);
            this.appendDummyInput("")
            .appendField(Blockly.Msg.SERIALPRINTINGSTRING);
                // .appendField("串口打印字符串");
            this.appendValueInput("value", String)
            this.setPreviousStatement(true, null);
            this.setNextStatement(true, null);
            this.setTooltip('');
        }
    };

    // 向串口写入一行
    Blockly.Blocks.writeLineToSerial = {
        init: function () {
            this.setColour(color_serial);
            this.appendDummyInput("")
            .appendField(Blockly.Msg.WRITELINETOSERIAL);
                // .appendField("向串口写入一行");
            this.appendValueInput("value", String)
            this.setPreviousStatement(true, null);
            this.setNextStatement(true, null);
            this.setTooltip('');
        }
    };

    // 串口写入数字
    Blockly.Blocks.writeNumberToSerial = {
        init: function () {
            this.setColour(color_serial);
            this.appendDummyInput("")
            .appendField(Blockly.Msg.WRITENUMBERTOSERIAL);
                // .appendField("串口写入数字");
            this.appendValueInput("value", Number)
            this.setPreviousStatement(true, null);
            this.setNextStatement(true, null);
            this.setTooltip('');
        }
    };

    // 串口写入数值
    Blockly.Blocks.writeValueToSerial = {
        init: function () {
            this.setColour(color_serial);
            this.appendDummyInput("")
                .appendField(Blockly.Msg.WRITEVALUETOSERIAL);
                // .appendField("串口写入数值");
            this.appendValueInput("name", String)
            this.appendDummyInput("")
                .appendField("=");
            this.appendValueInput("value", Number)
            this.setPreviousStatement(true, null);
            this.setNextStatement(true, null);
            this.setTooltip('');
        }
    };

    // 串口写入字符串
    Blockly.Blocks.writeStringToSerial = {
        init: function () {
            this.setColour(color_serial);
            this.appendDummyInput("")
            .appendField(Blockly.Msg.WRITESTRINGTOSERIAL);
                // .appendField("串口写入字符串")
            this.appendValueInput("value", String)
            this.setPreviousStatement(true, null);
            this.setNextStatement(true, null);
            this.setTooltip('');
        }
    };

    // 从串口读取行
    Blockly.Blocks.readLineToSerial = {
        init: function () {
            this.setColour(color_serial);
            this.appendDummyInput("")
            .appendField(Blockly.Msg.SERIALREADLINE);
                // .appendField("从串口读取行")
            this.setOutputShape(Blockly.OUTPUT_SHAPE_ROUND);
            this.setOutput(true, 'Number');
            this.setTooltip('');
        }
    };

    // 从串口读取，直到遇见标签
    Blockly.Blocks.readSerialData = {
        init: function () {
            this.setColour(color_serial);
            this.appendDummyInput("")
                .appendField(Blockly.Msg.SERIALREADLINEUNTIL)
                // .appendField("从串口读取行，直至遇到")
            this.appendValueInput("value", String)
            this.setOutputShape(Blockly.OUTPUT_SHAPE_ROUND);
            this.setOutput(true, 'Number');
            this.setTooltip('');
        }
    };

    // 从串口读取字符串
    Blockly.Blocks.readSerialString = {
        init: function () {
            this.setColour(color_serial);
            this.appendDummyInput("")
            .appendField(Blockly.Msg.READSTRINGTOSERIAL)
                // .appendField("从串口读取字符串")
            this.setOutputShape(Blockly.OUTPUT_SHAPE_ROUND);
            this.setOutput(true, 'Number');
            this.setTooltip('');
        }
    };

    //串行 重定向 Serial redirection to
    Blockly.Blocks.serialRedirection = {
        init: function () {
            this.setColour(color_serial);
            this.appendDummyInput("")
                // .appendField("串行 重定向到 TX")
                .appendField(Blockly.Msg.SERIALREDIRECTION)
                .appendField(Blockly.Msg.TX)
                .appendField(new Blockly.FieldDropdown([
                    ['p0', "pin0"],
                    ['p1', "pin1"],
                    ['p2', "pin2"],
                    ['p8', "pin8"],
                    ['p12', "pin12"],
                    ['p13', "pin13"],
                    ['p14', "pin14"],
                    ['p15', "pin15"],
                    ['p16', "pin16"],
                    ['USB_TX', "USB_TX"],
                    ['USB_RX', "USB_RX"],
                ]), "pinTX")
                .appendField(Blockly.Msg.RX)
                .appendField(new Blockly.FieldDropdown([
                    ['p0', "pin0"],
                    ['p1', "pin1"],
                    ['p2', "pin2"],
                    ['p8', "pin8"],
                    ['p12', "pin12"],
                    ['p13', "pin13"],
                    ['p14', "pin14"],
                    ['p15', "pin15"],
                    ['p16', "pin16"],
                    ['USB_TX', "USB_TX"],
                    ['USB_RX', "USB_RX"],
                ]), "pinRX")
                .appendField(Blockly.Msg.BAUDRATE)
                // .appendField("波特率为")
                .appendField(new Blockly.FieldDropdown([
                    ['115200', "115200"],
                    ['57600', "57600"],
                    ['38400', "38400"],
                    ['31250', "31250"],
                    ['28800', "28800"],
                    ['19200', "19200"],
                    ['14400', "14400"],
                    ['9600', "9600"],
                    ['4800', "4800"],
                    ['2400', "2400"],
                    ['1200', "1200"],
                ]), "baudRate");
            this.setPreviousStatement(true);
            this.setNextStatement(true);
            this.setTooltip('');
        }
    };

    // 串行 重定向到USB
    Blockly.Blocks.serialRedirectionUSB = {
        init: function () {
            this.setColour(color_serial);
            this.appendDummyInput("")
                .appendField(Blockly.Msg.SERIALREDIRECTIONUSB)
                // .appendField("串行 重定向到USB")
            this.setPreviousStatement(true, null);
            this.setNextStatement(true, null);
            this.setTooltip('');
        }
    };

    // 重置
    Blockly.Blocks.reset = {
        init: function () {
            this.setColour(color_control);
            this.appendDummyInput("")
            .appendField(Blockly.Msg.RESET)
                // .appendField("重置")
            this.setPreviousStatement(true, null);
            this.setNextStatement(true, null);
            this.setTooltip('');
        }
    };

    // 等待（μs）
    Blockly.Blocks.waiting = {
        init: function () {
            this.setColour(color_control);
            this.appendDummyInput("")
            .appendField(Blockly.Msg.WAIT)
                // .appendField("等待（μs）")
            this.appendValueInput("value", Number)
            this.setPreviousStatement(true, null);
            this.setNextStatement(true, null);
            this.setTooltip('');
        }
    };

    // 显示屏显示
    Blockly.Blocks.displayShow = {
        init: function () {
            this.setColour(color_display);
            this.appendDummyInput("")
                .appendField(Blockly.Msg.DISPLAYSHOW)
            this.appendValueInput("value", Number)
            this.setPreviousStatement(true, null);
            this.setNextStatement(true, null);
            this.setTooltip('');
        }
    };

    Blockly.Blocks.displayShowClear = {
        init: function () {
            this.setColour(color_display);
            this.appendDummyInput("")
                .appendField(Blockly.Msg.DISPLAYCLEARE)
            this.setPreviousStatement(true, null);
            this.setNextStatement(true, null);
            this.setTooltip('');
        }
    };

    return Blockly;
}

module.exports = MicrobitUnoBlocks;
